package com.hspedu.homework;

import com.hspedu.poly_.polyparameter.Employee;

public class Homework03 {
    public static void main(String[] args) {
        Teacher teacher1 = new Professor("大龙",21,"优秀",6000,1.3);
        System.out.println(teacher1.introduce());
        System.out.println();
        Teacher teacher2 = new AProfessor("小龙",20,"优秀",5000,1.2);
        System.out.println(teacher2.introduce());

        System.out.println();
        Teacher teacher3 = new Lecturer("小张",19,"良好",4000,1.1);
        System.out.println(teacher3.introduce());
    }
}

class Teacher{
    private String name;
    private int age;
    private String post;
    private double salary;

    //用字符串返回教师信息
    public String introduce(){
       return "姓名:" + this.name + "\n年龄:"+this.age + "\n职称:"+this.post + "\n工资:"+this.salary;
    }

    public Teacher(String name, int age, String post, double salary) {
        this.name = name;
        this.age = age;
        this.post = post;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }
}

//教授类
class Professor extends Teacher {
    private double grade;

    //重写父类中introduce方法
    @Override
    public String introduce() {
        return "教授\n"+super.introduce() +"\n工资级别:" + this.grade + "\n实际工资:" + (this.grade * getSalary());
    }

    public Professor(String name, int age, String post, double salary, double grade) {
        super(name, age, post, salary);
        this.grade = grade;
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }
}

//父教授类
class AProfessor extends Teacher{
    private double grade;

    //重写父类中introduce方法
    @Override
    public String introduce() {
        return "副教授\n"+super.introduce() +"\n工资级别:" + this.grade + "\n实际工资:" + (this.grade * getSalary());
    }

    public AProfessor(String name, int age, String post, double salary, double grade) {
        super(name, age, post, salary);
        this.grade = grade;
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }
}

//教授类
class Lecturer extends Teacher{
    private double grade;

    //重写父类中introduce方法
    @Override
    public String introduce() {
        return "讲师\n"+super.introduce() +"\n工资级别:" + this.grade + "\n实际工资:" + (this.grade * getSalary());
    }

    public Lecturer(String name, int age, String post, double salary, double grade) {
        super(name, age, post, salary);
        this.grade = grade;
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(double grade) {
        this.grade = grade;
    }
}